package com.bdqn.qnnews.wemedia.controller.v1;

import com.bdqn.qnnews.common.base.R;
import com.bdqn.qnnews.wemedia.entity.WmChannel;
import com.bdqn.qnnews.wemedia.service.WmChannelService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author xlz
 * @since 2023-12-26
 * @description 频道信息表
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/v1")
@Tag(name = "频道信息表控制器类",
        description = "WmChannelController 频道信息表 后端数据接口")
public class WmChannelController {

    private final WmChannelService wmChannelService;


    /**
     * 查询所有频道数据
     */
    @Operation(summary = "查询所有频道", description = "查询")
    @GetMapping("/channel/channels")
    public R<List<WmChannel>> getWmChannel() {

        final List<WmChannel> list = wmChannelService.list();

        return R.ok(list);
    }


    /**
     * 通过id查询 频道信息表
     * @param id id
     * @return Result
     */
    @Operation(summary = "通过id查询", description = "通过id查询")
    @GetMapping("/{id}")
    public R getById(@PathVariable("id") Long id) {
        return R.ok();
    }

    /**
     * 新增 频道信息表
     * @param wmChannel 频道信息表
     * @return Result
     */
    @Operation(summary = "新增频道信息表", description = "新增频道信息表")
    @PostMapping("")
    public R save(@RequestBody WmChannel wmChannel) {
        return R.ok();
    }

    /**
     * 修改 频道信息表
     * @param wmChannel 频道信息表
     * @return Result
     */
    @Operation(summary = "修改频道信息表", description = "修改频道信息表")
    @PutMapping("")
    public R updateById(@RequestBody WmChannel wmChannel) {
        return R.ok();
    }

    /**
     * 通过id删除 频道信息表
     * @param id id
     * @return Result
     */
    @Operation(summary = "通过id删除频道信息表",
               description = "通过id删除频道信息表")
    @DeleteMapping("/{id}")
    public R removeById(@PathVariable Long id) {
        return R.ok();
    }

}
